<?php
session_start();

if (isset($_SESSION['authorised']) && $_SESSION['authorised'] == true) {
    if (isset($_SESSION['type'])) {
        if ($_SESSION['type'] == 'administrator') {
?>
            <html xmlns="http://www.w3.org/1999/xhtml">
                <head>
                    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                    <title>Account Creation</title>
                    <link href="StyleSheet.css" rel="stylesheet" type="text/css" />
                    <style>
                        .nav {
                            width:210px;
                            height:auto;
                            border:thin solid #09C;

                            margin-left: 10px;
                            text-align : center;}

                        .mainline {
                            width:712px;

                            height:auto;
                            text-align : center;}
                        </style>
						
						<script>
	function setOptions(chosen) 
	{
		var selbox = document.myform.day;
		selbox.options.length = 0;
		
		if (chosen == "Jan" || chosen == "Mar" || chosen == "May" || chosen == "Jul" || chosen == "Aug" || chosen == "Oct" || chosen == "Dec")
		{
		  <?php 
		  for($i=1; $i < 32; $i++)
		  {
		  	print ("selbox.options[selbox.options.length] = new Option($i,$i);\n");
		  }
		  ?>
		}
		else if (chosen == "Feb")
		{
		  <?php 
		  for($i=1; $i < 29; $i++)
		  {
		  	print ("selbox.options[selbox.options.length] = new Option($i,$i);\n");
		  }
		  ?>
		}
		else
		{
		  <?php 
		  for($i=1; $i < 31; $i++)
		  {
		  	print ("selbox.options[selbox.options.length] = new Option($i,$i);\n");
		  }
		  ?>
		}
		
		
	}
			</script>
			
                    </head>

                    <center>
                        <body bgcolor="#FFFFFF">
                            <div id="wrapper">
                            <div id="header">
                                <h1></h1>
                            </div>
                            <div id="header2">
                                <h3></h3>
                            </div>

                            <div id="nav">
                                <h4>Navigation</h4>
                                <center>
                                    <script src="adminjs.js" type="text/javascript"></script><noscript><OBJECT id="adminobj" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" WIDTH=230 HEIGHT=200> <PARAM NAME=movie VALUE="admin.swf"> <PARAM NAME=menu VALUE=false> <PARAM NAME=quality VALUE=high> <PARAM NAME=wmode VALUE=opaque> <param name="scale" value="noscale" /> <PARAM NAME=bgcolor VALUE=#FFFFFF> <EMBED src="admin.swf" menu=false quality=high scale="noscale" wmode=opaque bgcolor=#FFFFFF  WIDTH=230 HEIGHT=200 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED></OBJECT></noscript>
                                </center>
                            </div>
                            <div id="mainline">
                                <h4> Create a New Account </h4>
                                <div id="body">                                    
                                    <form name = "myform" action="create_student_submit.php" method="post">
                                        <table width="712" cellpadding="2" class="infotable" align="left">
                                           <tr align="left">
                                                <th height="42" scope="row">Parent's Lastname:</th>
                                                <td>
                                                    <input type="text" size="50" maxlength="256" id="parent_lastname" name="parent_lastname"/>
                                                </td>
                                            </tr>
											<tr align="left">
                                                <th height="42" scope="row">Parent's Firstname:</th>
                                                <td>
                                                    <input type="text" size="50" maxlength="256" id="parent_firstname" name="parent_firstname"/>
                                                </td>
                                            </tr>
											<tr align="left">
                                                <th height="42" scope="row">Parent's middlename:</th>
                                                <td>
                                                    <input type="text" size="50" maxlength="256" id="parent_middlename" name="parent_middlename"/>
                                                </td>
                                            </tr>
                                            <tr align="left">
                                                <th height="42" scope="row">School:</th>
                                                <td>
                                                    <input type="text" size="50" maxlength="256" id="school" name="school"/>
                                                </td>
                                            </tr>
                                            <tr align="left">
                                                <th height="42" scope="row">Grade Level:</th>
                                                <td>
                                                    <input type="text" size="50" maxlength="256" id="level" name="level"/>
                                                </td>
                                            </tr>
                                            <tr align="left">
                                                <th height="42" scope="row">Date Enrolled:</th>
                                                <td><select name="month" onchange="setOptions(document.myform.month.options[document.myform.month.selectedIndex].value);">
													<option value="" selected="selected">MONTH</option>
													<option value="Jan">January</option>
													<option value="Feb">Febuary</option>
													<option value="Mar">March</option>
													<option value="Apr">April</option>
													<option value="May">May</option>
													<option value="Jun">June</option>
													<option value="Jul">July</option>
													<option value="Aug">August</option>
													<option value="Sep">September</option>
													<option value="Oct">October</option>
													<option value="Nov">November</option>
													<option value="Dec">December</option>
												</select>
												<select name="day">
													<option value="" selected="selected">DAY</option>
												</select>
												<select name="year">
													<?php
														for($i=1990; $i<2012; $i++)
														{
															echo "<option value=$i>$i</option>";
														}
													?>
												</select>
												</td>

                                            </tr>
                                            <tr align="left">
                                                <td></td>
                                                <td><input type = "submit" value ="Submit" /></td>
                                            </tr>
                                        </table>
                                    </form>
                                </div>
                            </div>



                            <p align="justify"><br /></p>
                        </div>

                        <br class="clearfloat"/>
                        <br />

                        <div id="footer">
                            <p align="center">
                                Tutorial Business Manager: info@tbms.com <br />Credits/Engineers: Aquino, Chloebelle; Dela Cruz, Roy Erwin; Maliwanag, Ranyel Bryan; Manzano, Audrey Ann; Ng, Sheila Regine<br />
                                <br />copyright 2011</p>
                        </div>
                    </body>
                </center>
            </html>
<?php
        } elseif ($_SESSION['type'] == 'student') {
            header('Location: studenthome.php');
            exit();
        } elseif ($_SESSION['type'] == 'tutor') {
            header('Location: tutorindex.php');
            exit();
        } elseif ($_SESSION['type'] == 'parent') {
            header('Location: parentindex.php');
            exit();
        }
    }
} else {
    header('Location: index.php');
}
?>
